package com.feng.lang;

public class StringTest {
	public static void main(String args[]) {
		String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><AppDownInfo xmlns:tns=\"out.appstore.lps.lenovo.com\"><AppId>2241</AppId><VersionCode>11</VersionCode><VersionName>1.3.7</VersionName><AppSize>527099</AppSize><AppName>测试审核</AppName><IsLca>true</IsLca><PackageName>com.androidemu.gba</PackageName><Developer>liubz</Developer><IsLiteVersion>false</IsLiteVersion><SupportMinVersion>1.0</SupportMinVersion><IsPay>false</IsPay><IconUrl>http://dl.dev.surepush.cn/ams/fileman/img/icon/2010-05-11064417-12735746572216072.png</IconUrl><ManifestInfo>&lt;![CDATA[&lt;?xml version=\"1.0\" encoding=\"utf-8\"?>"
				+ "&lt;manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionCode=\"11\" android:versionName=\"1.3.7\" package=\"com.androidemu.gba\">&lt;uses-sdk android:minSdkVersion=\"2\">&lt;/uses-sdk>&lt;application android:label=\"@7F060000\" android:icon=\"@7F020000\">&lt;activity android:name=\"GameBoid\"></ManifestInfo></AppDownInfo>";
		System.out.println(getContent(xml));
	}

	public static String getContent(String s) {
		s = s.replaceAll("&ensp;", " ");
		s = s.replaceAll("&nbsp;", " ");
		s = s.replaceAll("&emsp;", "　");
		s = s.replaceAll("&reg;", "®");
		s = s.replaceAll("&lt;", "<");
		s = s.replaceAll("&gt;", ">");
		s = s.replaceAll("&ldquo;", "“");
		s = s.replaceAll("&rdquo;", "”");
		s = s.replaceAll("&quot;", "“");
		s = s.replaceAll("&rsquo;", "’");
		s = s.replaceAll("&lsquo;", "‘");
		s = s.replaceAll("&mdash;", "—");
		s = s.replaceAll("&ndash;", "–");
		s = s.replaceAll("&middot;", "·");
		s = s.replaceAll("&trade;", "™");
		s = s.replaceAll("&copy;", "©");
		s = s.replaceAll("&hellip;", "…");
		s = s.replaceAll("<br>", "\r\n");
		s = s.replaceAll("<br/>", "\r\n");
		s = s.replaceAll("<br />", "\r\n");
		s = s.replaceAll("  ", "　");
		s = s.replaceAll("&amp;", "&");
		return s;
	}

	public static String getHtmlContent(String s) {
		s = s.replaceAll("&", "&amp;");
		s = s.replaceAll("　", " ");
		s = s.replaceAll("…", "&hellip;");
		s = s.replaceAll("®", "&reg;");
		s = s.replaceAll("<", "&lt;");
		s = s.replaceAll(">", "&gt;");
		s = s.replaceAll("\r\n", "<br>");
		s = s.replaceAll("\r\n", "<br/>");
		s = s.replaceAll("\r\n", "<br />");
		s = s.replaceAll("“", "&ldquo;");
		s = s.replaceAll("”", "&rdquo;");
		s = s.replaceAll("“", "&quot;");
		s = s.replaceAll("’", "&rsquo;");
		s = s.replaceAll("‘", "&lsquo;");
		s = s.replaceAll("—", "&mdash;");
		s = s.replaceAll("–", "&ndash;");
		s = s.replaceAll("·", "&middot;");
		s = s.replaceAll("™", "&trade;");
		s = s.replaceAll("©", "&copy;");
		return s;
	}
}
